package com.caiyigo.baihua.serviceImpl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import com.caiyigo.baihua.dao.SystemUserRoleMapper;
import com.caiyigo.baihua.model.SystemUserRole;
import com.caiyigo.baihua.service.UserRoleService;

/**
 * @author caihaihui
 * 
 */
@Transactional
@Service
public class UserRoleServiceImpl implements UserRoleService {
	@Autowired
	SystemUserRoleMapper mapper;

	@Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRED)
	@Override
	public int deleteByPrimaryKey(Integer id) {

		return mapper.deleteByPrimaryKey(id);
	}

	@Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRED)
	@Override
	public int insert(SystemUserRole record) {

		return mapper.insert(record);
	}

	@Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRED)
	@Override
	public int insertSelective(SystemUserRole record) {

		return mapper.insertSelective(record);
	}

	@Override
	public SystemUserRole selectByPrimaryKey(Integer id) {

		return mapper.selectByPrimaryKey(id);
	}

	@Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRED)
	@Override
	public int updateByPrimaryKeySelective(SystemUserRole record) {

		return mapper.updateByPrimaryKeySelective(record);
	}

	@Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRED)
	@Override
	public int updateByPrimaryKey(SystemUserRole record) {

		return mapper.updateByPrimaryKey(record);
	}

	@Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRED)
	@Override
	public int deleteByUserid(Integer ids) {

		return mapper.deleteByUserid(ids);

	}

	@Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRED)
	@Override
	public int batchInsert(List<SystemUserRole> list) {

		return mapper.batchInsert(list);
	}

	@Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRED)
	@Override
	public int batchDeleteByUserid(String ids) {
		String[] id = ids.split(",");

		return mapper.batchDeleteByUserid(id);
	}

}
